package com.hunan.api.catv.action.function.remote;

import com.hunan.api.catv.action.BaseAction;
import com.hunan.api.catv.annotation.MemberAuth;
import com.hunan.api.catv.common.Api;
import com.hunan.api.catv.entity.Result;
import com.hunan.api.catv.service.biz.function.remote.RemoteControlBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.NotNull;

/**
 * @author wangchao
 * @date 2021-04-26 10:15 上午
 */
@RestController
@RequestMapping(Api.remote)
@Validated
public class RemoteControlAction extends BaseAction {

    @Autowired
    RemoteControlBiz remoteControlBiz;

    @MemberAuth
    @GetMapping("/remoteControl/{keyCode}")
    public Result remoteControl(HttpServletRequest request, @NotNull(message = "键值不能为空") @PathVariable("keyCode") String keyCode) {
        return buildResult(remoteControlBiz.remoteControl(getMemberIdV2(request), keyCode));
    }
}
